<?php

/**
 * Name: 反馈仓库层
 * User: Silent
 * Date: 2025-10-11
 * Time: 22:09:23
 */

namespace App\Repositories\Message;

use App\Models\Message\Feedback;
use App\Repositories\BaseRepository;
use Illuminate\Support\Facades\Log;

class FeedbackRepository extends BaseRepository
{
    public function __construct(Feedback $model)
    {
        parent::__construct($model);
    }

    /**
     * 添加问题.
     *
     * @param array $inputs
     * @return array
     */
    public function addData(array $inputs): array
    {
        try {
            $riskSource = app(Feedback::class)->create($inputs);

            return [
                'success' => true,
                'message' => '添加成功',
                'data'    => $riskSource,
            ];
        } catch (\Exception $e) {
            Log::channel('feedback')->error('添加反馈失败: ' . $e->getMessage());

            return [
                'success' => false,
                'message' => '添加失败: ' . $e->getMessage(),
            ];
        }
    }
}
